<template>
  <div id="app">
    <router-view/>
    <theme-picker/>
  </div>
</template>

<script>
    import ThemePicker from '@/components/ThemePicker'
    import {getConfigKey} from '@/api/system/config';

    var that;
    export default {
        name: 'App',
        components: {ThemePicker},
        metaInfo() {
            return {
                title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
                titleTemplate: async title => {
                    const favicon = document.querySelector("link[rel~='icon']");
                    if (favicon) {
                        favicon.href = "/AM-LOGO.png";
                    } else {
                        const link = document.createElement('link');
                        link.rel = 'icon';
                        link.href = "/AM-LOGO.png";
                        document.getElementsByTagName('head')[0].appendChild(link);
                    }
                    let res = await getConfigKey('logs');
                    document.title = res.msg;
                }
            }
        },
        data() {
            return {
                data: [],
                user: this.$store.state.user,
                timer: null
            }
        },
    }
</script>
